package com.hpf.blog.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hpf.blog.domain.BlogCategory;
import com.hpf.blog.service.BlogCategoryService;

@Controller
@RequestMapping("/blog")
public class BlogCategoryController {

	private String prefix = "blog/category";
	 @Autowired 
	private BlogCategoryService blogCategoryService;
	
	 @GetMapping("/test")
	 public String test() {
		 return prefix + "/tt";
	 }
	@GetMapping("/{id}")
	@ResponseBody
	public BlogCategory getById(@PathVariable("id") int id) {
		return blogCategoryService.findById(id);
	} 
}
